package com.lottery.ruok.lottrey.chat.model.redpacket.message.receiveRedPacketMessage;

import android.content.Context;
import android.text.Spannable;
import android.text.SpannableString;
import android.view.View;
import android.view.ViewGroup;

import com.lottery.ruok.lottrey.chat.model.redpacket.message.receiveRedPacketMessage.view.ReceiveRedPacketView;

import io.rong.imkit.model.ProviderTag;
import io.rong.imkit.model.UIMessage;
import io.rong.imkit.widget.provider.IContainerItemProvider;

/**
 * Created by Beyond on 2016/12/5.
 */

@ProviderTag(messageContent = ReceiveRedPacketMessage.class, showPortrait = false, showProgress = true, centerInHorizontal = true,showSummaryWithName = false)
public class ReceiveRedPacketMessageItemProvider extends IContainerItemProvider.MessageProvider<ReceiveRedPacketMessage> {
    private final static String TAG = "ContactMessageItemProvider";

    @Override
    public View newView(Context context, ViewGroup group) {
        ReceiveRedPacketView redPacketView = new ReceiveRedPacketView(context);
        return redPacketView;
    }

    @Override
    public void bindView(View v, int position, final ReceiveRedPacketMessage content, final UIMessage message) {
        if (v instanceof ReceiveRedPacketView) {
            ReceiveRedPacketView view = (ReceiveRedPacketView) v;
            view.setData(content);
        }
    }

    @Override
    public Spannable getContentSummary(final ReceiveRedPacketMessage receiveRedPacketMessage) {
        return null;
    }

    @Override
    public Spannable getContentSummary(Context context, final ReceiveRedPacketMessage receiveRedPacketMessage) {
        return new SpannableString("[ 红包 ]");
    }

    @Override
    public void onItemClick(View view, int position, ReceiveRedPacketMessage content, UIMessage message) {

    }
}
